package com.lucker.service.push;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
import java.util.Date;

import com.lucker.common.util.DateTimeUtil;

public class M2MReceive extends Thread{
	
	private Socket s;
	 
	 
    public M2MReceive(Socket s) {
        this.s = s;
    }
 
    @Override
    public void run() {
        try {
            //构建输入流
            BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream(),"GBK"));
            //不断的接收信息
            while(true){
                String info = null;
                //接收信息
                if((info=br.readLine()) != null){
                    System.out.println(DateTimeUtil.getDate(new Date(), "yy-MM-dd HH:mm:ss" ) + "  服务器发送过来的数据: " +info);
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
